{header}
<table class="table table-striped">
  <thead>
    <tr>
      <th scope="col">ID</th>
      <th scope="col">管理类型</th>
      <th scope="col">账号</th>
      <th scope="col">操作</th>
    </tr>
  </thead>
  <tbody>
    {tr}
  </tbody>
</table>
<script type="text/javascript">
  function cancel(id) {
    $.ajax({
      url: '{base_url}library/cancel_admin',
      type: 'post',
      data: {
        id: id
      },
      success: function (data) {
        var d = data.split(':');
        if (d.length !== 2) {
          console.error(data);
          layer.alert('服务器返回非法数据', {icon: 2});
          return;
        }
        if (d[0] === 'fail') {
          layer.alert('撤销失败:' + d[1], {icon: 2});
          console.error('撤销失败:' + d[1]);
        } else if (d[0] === 'success') {
          location.reload();
        } else {
          console.error(data);
          layer.alert('服务器返回多余数据', {icon: 2});
        }
      },
      error: function (data) {
        layer.alert('撤销失败', {icon: 2});
        console.error(data.responseText);
      }
    });
  }
</script>
{nav}
{footer}

